This invention relates to the field of computer systems. More particularly, a system and method are provided for performing garbage collection with a dynamic young generation.
Many generational garbage collection schemes employing multiple generations suffer from over-promotion. That is, they promote too many memory objects from a younger generation to an older generation, or promote objects too frequently. As a result, the older generation must be garbage collected more frequently than it would otherwise.
One reason for over-promotion is that traditional generational garbage collection schemes work in closed environments, without considering or applying externally available information about the objects it handles. For example, garbage collectors generally do not have access to, or do not use, information concerning how likely or how soon a set of data objects will become garbage.
Some generational garbage collection schemes employ a fixed-size window that continually moves across a section of memory. The window defines a younger generation of memory and data objects, while the area behind the moving window defines an older generation and contains data objects promoted from the younger generation because they survived a garbage collection performed on that generation. These schemes also suffer from over-promotion, because the window continually moves, and every object in the younger generation that survives a garbage collection is automatically promoted to the older generation, regardless of how likely or how soon the survivor will become garbage.